package com.zzy.test;

import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;

import weibo4j.Timeline;
import weibo4j.Weibo;
import weibo4j.examples.oauth2.Log;
import weibo4j.model.Status;
import weibo4j.model.WeiboException;


/**
 * 根据微博id
 * 转发此微博
 * @author eason
 *
 */
public class Repost {

	public static void main(String[] args) {
		Timeline tm = new Timeline();
		tm.client.setToken("2.008iGhsCgrdWgDebec65d6c60B_qJ8");
		
		Timer timer = new Timer();
		SendReportTask task = new SendReportTask(tm);
		timer.scheduleAtFixedRate(task, 1000 * 1L, 1000 * 60 * 2L);
	}
	
}

class SendReportTask extends TimerTask {
	
	private static final String ID =  "3502405314453693";//小米F码 小米手机
	private static final String COMMENT = "我要@韩寒 签名";
	//private static final String COMMENT = "凡客犀利";
	public static final String[] COMMETN = {"[可爱]", "[搞笑]", "笔尖少侠[不好意思]","邪恶[巨汗]","[笑哈哈]","成功[愚人节]","方向[瞧瞧]","深港通[膜拜了]","歌后放心[互相膜拜]","easons[发红包]","李大仁[好棒]","陈柏霖[抓狂]","范冰冰[好棒]","陈奕迅[发红包]"};
	private static int num = 0;
	
	private Timeline tm;
	
	public SendReportTask(Timeline tm) {
		this.tm =tm;
	}
	
	public void run() {
		try {
			Status status = tm.Repost(ID, COMMENT + new Random().nextInt() + "'" + new Random().nextDouble() + COMMETN[num++ % 10], new Integer(0));
			Log.logInfo(status.toString());
			Log.logInfo("===========================================成功转发了" + num + "次===========================================");
		} catch (WeiboException e) {
			e.printStackTrace();
		}
	}
}

